<?php
namespace app\sadmin\controller;
use think\Controller;
use think\Db;

class Manageadmin extends Controller
{
   public function index(){
       	$admin=Db::name("admin")->select();
       	// dump($shop);exit;
       	$this->assign("admin",$admin);

        $v = Db::query('select *from club v,admin t where v.clubid=
            t.adminid order by v.clubid desc');
        $this->assign("admin",$v);

        $club=Db::name("club")->select();
        $this->assign("club",$club);
       	return $this->fetch();
       }

        

       public function  close($adminid){
       $result=Db::name("admin")->where("adminid='$adminid'")->find();

       if ($result['state']==0)
       {
           $state1=1;
       }
       else{
           $state1=0;
       }
       $res=Db::name("admin")->where("adminid='$adminid'")->update(['state'=>$state1]);
        if($res){
            $this->success("成功");
        }else{
            $this->error("失败");
        }
    }

      public function edit($adminid){
       $result=Db::name("admin")->where("adminid='$adminid'")->find();
       $res=Db::name("admin")->where("adminid='$adminid'")->update(['adminpwd'=>md5(123)]);
        if($res){
            $this->success("成功");
        }else{
            $this->error("失败");
        }


   
}


}